/**
 * @projectName study-note
 * @package Singleton
 * @className Singleton.Singleton03
 */
package Singleton;

/**
 * Singleton03
 * @description 单例模式--内部类
 * 优点：JVM保证线程安全；调用时实例化
 * 缺点：使用内部类
 * @author answer_wx
 * @date 2022/7/4 14:42
 * @version 1.0
 */
public class Singleton03 {
    private Singleton03() {
    }

    private static class Singleton03Holder {
        private static Singleton03 INSTANCE = new Singleton03();
    }

    public static final Singleton03 getInstance() {
        return Singleton03Holder.INSTANCE;
    }
}